import scala.collection.mutable.ListBuffer

package codegen
{	
	class SyntaxNode() 
	{	  
	    protected var command : SyntaxNode => String = (node:SyntaxNode)=>"";
	    var name = "";
	    var isBoxAddition = false;
	    var isRoot = false;
	    
	    protected var parent : SyntaxNode = null;
	    protected[codegen] val children  = ListBuffer[SyntaxNode]();
	    	    
		def PrintCommand() = print(command);
		def setParent(parent : SyntaxNode) = {this.parent = parent;}

		def addChild(child : SyntaxNode) = { children += child; child.setParent(this); } 
		def isLeaf() = children.isEmpty
		def Next() : SyntaxNode = children.iterator.next()
		def hasNext() = children.iterator.hasNext;	
		def setCommandFunction(cmd : SyntaxNode => String) = {command = cmd;}
		def getCommand() : String = {command(this)}
		def getParentName() = parent.name;
	}
}